#include <vector>
#include <fstream>
#include <iostream>

using namespace std;

bool is_leap(int year) {
  return (year % 4 == 0 && year % 100 != 0) ||
   (year % 4 == 0 && year % 400 == 0);
}

int main(int argc, char const *argv[])
{
  /* code */
  // 处理输入
  ifstream ifs("FridayTheThirteenth.in");
  int n = 0;
  ifs >> n; // 1900 ~ 1900 + n - 1

  int month = 1, day = 1;
  int dow = 1; // 星期几 - day of week
  int year = 1900;
  int end_year = 1900 + n;

  // {0, 0, 0, 0, 0, 0, 0, 0}
  //  x, 
  vector<int> week_stat(8, 0);

  while (year < end_year) {
    // 计算每个月的第 13 天是星期几
    // 一天天数
    bool switch_month = false;
    bool switch_year = false;

    if (day == 13) {
      week_stat[dow] += 1;
    }

    // 如果这一天是一个月的末尾，我们就要把 月份 + 1
    // 天数重置为 1。switch_month -> true
    if (
      (month == 1 && day == 31) ||
      (is_leap(year) && month == 2 && day == 29) ||
      (!is_leap(year) && month == 2 && day == 28) ||
      (month == 3 && day == 31) ||
      (month == 4 && day == 30) ||
      (month == 5 && day == 31) ||
      (month == 6 && day == 30) ||
      (month == 7 && day == 31) ||
      (month == 8 && day == 31) ||
      (month == 9 && day == 30) ||
      (month == 10 && day == 31) ||
      (month == 11 && day == 30)
    ) {
      ++month;
      day = 1; // 天数 + 1
      switch_month = true;
    }

    if (month == 12 && day == 31) {
      ++year;
      month = 1;
      day = 1; // 天数 + 1
      switch_year = true;
    }

    // 对于不是上面两种特殊日子的情况
    // 手动 ++day
    if (!switch_month && !switch_year) {
      ++day;
    }

    ++dow;

    if (dow > 7) {
      dow = 1;
    }
  }

  // 保存 week_stat 到文件
  ofstream ofs("FridayTheThirteenth.out");
  ofs << week_stat[6] << " "
       << week_stat[7] << " "
       << week_stat[1] << " "
       << week_stat[2] << " "
       << week_stat[3] << " "
       << week_stat[4] << " "
       << week_stat[5]
       << endl;

  return 0;
}
